<template>
    <div>
        <el-card class="box-card">
            <div slot="header" class="clearfix">
                <h1>意见调查表</h1>
                <el-button plain icon="el-icon-plus" @click="Add">增加意见题目</el-button>
            </div>
            <el-card class="box-card" v-for="(item,index) in array" :key="(item,index)">
                <div>
                    意见名{{ index+1 }}
                    <el-input  v-model="item.topic" style="width:55%;" placeholder="请输入要调查的意见题目"></el-input>
                </div>
                <br/>
                <div>
                    <div style="margin-left:10px;">
                    </div>
                    <el-input v-model="item.content" style="width:65%;" type="textarea" placeholder="请输入内容"></el-input>
                    &nbsp;
                    <el-button type="danger" icon="el-icon-delete" @click="Del(item.index)">删除该问题</el-button>
                </div>
            </el-card>
        </el-card>
        <el-button plain icon="el-icon-bottom">保存</el-button>
        <el-button type="success" icon="el-icon-s-promotion">发布表单</el-button>
    </div>    
</template>

<script>
    export default {
    data() {
        return {
            array:[]


      }
    },
    methods: {
        //增加问题
        Add(){
            this.array.push({topic:"",content:""});
        },
        Del(i){
            this.array.splice(i,1);
        }
    }
  }
</script>

